package edu.nf.exam.dao.impl;

import edu.nf.exam.dao.UserTaskInfoDao;
import edu.nf.exam.entity.UserTaskInfo;
import edu.nf.exam.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @Author : QYM
 * @create 2021/6/17
 * 用户任务表--接口实现类
 */
public class UserTaskInfoDaoImpl implements UserTaskInfoDao {
    /**
     * 添加
     * @param userTaskInfo
     * @return
     */
    @Override
    public int add(UserTaskInfo userTaskInfo) {
        SqlSession sqlSession = MyBatisUtil.getSqlSession(true);
        int r = sqlSession.getMapper(UserTaskInfoDao.class).add(userTaskInfo);
        sqlSession.close();
        return r;
    }

    /**
     * 多条件查询
     * @param userTaskInfo
     * @return
     */
    @Override
    public List<UserTaskInfo> select(UserTaskInfo userTaskInfo) {
        SqlSession sqlSession = MyBatisUtil.getSqlSession(true);
        List<UserTaskInfo> list = sqlSession.getMapper(UserTaskInfoDao.class).select(userTaskInfo);
        sqlSession.close();
        return list;
    }

    /**
     * 修改
     * @param userTaskInfo
     * @return
     */
    @Override
    public int update(UserTaskInfo userTaskInfo) {
        SqlSession sqlSession = MyBatisUtil.getSqlSession(true);
        int r = sqlSession.getMapper(UserTaskInfoDao.class).update(userTaskInfo);
        sqlSession.close();
        return r;
    }
}
